home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PCGPEV10.ZIP / TIMER.ASM < prev    next >
Assembly Source File  |  1994-05-09  |  4KB  |  130 lines

  1. ;--------------------------------------------------------------------------
  2. ; Here is a source for measuring relative speed of computer. This source
  3. ; will NOT function properly under multitaskers, as they use timer them-
  4. ; selves. At least DesqView, OS/2 and Windows mess up with timer.
  5. ;
  6. ; This source is copyright 1994 of Teemu Peltonen aka Quark/Remedy Prods.
  7. ; If you modify this source, please do not spread it! You may spread the
  8. ; unmodified source as much as you like, but please check that length of
  9. ; the actual source (not including this comment between vertical lines) is
  10. ; 91 lines!
  11. ;
  12. ; The way of measuring computer's speed is not the best possible, but it
  13. ; works. Here's a small kind of table of speeds:
  14. ;
  15. ; CPU           Output value
  16. ; 486DX/33MHz   024Ch
  17. ; 486SX/20MHz   03D4h
  18. ; 386DX/40MHz   05EDh
  19. ; 386DX/16MHz   0DBAh
  20. ; 286  /10MHz   1500h
  21. ; 086  /4.77MHz 6006h
  22. ;
  23. ; Notice! Values may differ from these about 2 up or down. You should
  24. ; run the tester for about five times and use the value that seems to
  25. ; appear most times. Disk caches and others can mess up test.
  26. ;
  27. ; Thanks to my BBS's users for testing this piece of software!
  28. ;
  29. ; If you wish to add your computer's speed here, please contact author.
  30. ; Feel free to contact me, even if you wouldn't want to add your speed..
  31. ; Contact addresses are:
  32. ; teemu.peltonen@stream.nullnet.fi in Internet
  33. ; Teemu Peltonen@2:222/100         in Fidonet
  34. ; Teemu Peltonen@68:100/100        in DGi-net
  35. ; Or call Bitstream BBS (+358-21-4383244) and leave a comment to operator
  36. ; (command C).
  37. ;--------------------------------------------------------------------------
  38. stacki  segment para stack use16 'stack'
  39.         dw      100h dup (?)
  40. stacki  ends
  41.  
  42. data    segment para public use16 'data'
  43. hexval  db      '0123456789ABCDEF'
  44. stringi db      'Relative speed of computer is '
  45. d       db      0
  46. c       db      0
  47. b       db      0
  48. a       db      0
  49. endi    db      'h.$'
  50. data    ends
  51.  
  52. code    segment para public use16 'code'
  53.         assume cs:code, ds:data, ss:stacki
  54. startup:
  55.         mov     ax, seg data
  56.         mov     ds, ax
  57.  
  58.         cli
  59.  
  60.         mov     al, 34h
  61.         out     43h, al         ;OUT can be used as immediate
  62.                                 ;if register value under 100h
  63.  
  64.         xor     al, al
  65.         out     40h, al
  66.         out     40h, al
  67.  
  68.         sti
  69.  
  70.         mov     cx, 1000h       ;action here,
  71. here:                           ;must not take
  72.         dec     cx              ;more than 1/18
  73.         jnz     here            ;(0.0555) seconds to run
  74.  
  75.         cli
  76.  
  77.         mov     al, 4h
  78.         out     43h, al
  79.  
  80.  
  81.         in      al, 40h
  82.         mov     dl, al
  83.         in      al, 40h
  84.         mov     dh, al
  85.  
  86.         sti
  87.  
  88.         neg     dx              ;Action took bx/1193180 seconds
  89.  
  90.         mov     cl, dh
  91.         and     cl, 11110000b
  92.         shr     cl, 4
  93.         xor     bx, bx
  94.         mov     bl, cl
  95.         mov     ah, hexval[bx]
  96.         mov     d, ah
  97.  
  98.         mov     cl, dh
  99.         and     cl, 00001111b
  100.         xor     bx, bx
  101.         mov     bl, cl
  102.         mov     ah, hexval[bx]
  103.         mov     c, ah
  104.  
  105.         mov     cl, dl
  106.         and     cl, 11110000b
  107.         shr     cl, 4
  108.         xor     bx, bx
  109.         mov     bl, cl
  110.         mov     ah, hexval[bx]
  111.         mov     b, ah
  112.  
  113.         mov     cl, dl
  114.         and     cl, 00001111b
  115.         xor     bx, bx
  116.         mov     bl, cl
  117.         mov     ah, hexval[bx]
  118.         mov     a, ah
  119.  
  120.  
  121.         mov     ax, 0900h
  122.         mov     dx, offset stringi
  123.         int     21h
  124.  
  125.         mov     ax, 4c00h
  126.         int     21h
  127.  
  128. code    ends
  129.         end     startup
  130.